﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Threading;

using DataAccess;
namespace tracnghiemonline2
{
    public partial class Task : System.Web.UI.Page
    {
        public int test;
        public string title;
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                test = int.Parse(RouteData.Values["id"].ToString());
                if (Session["user"] == null)
                {
                    Response.Cookies["user"].Expires = DateTime.Now.AddDays(-1);
                }
                var check_active = new TblTestController().FetchAll().Where(x=>x.TestId==test).Single();
                title = check_active.TestTitle;
                if(check_active.TestActive==false)
                    Response.Redirect("~/trang-chu");
                
            }
            catch
            {
                Response.Redirect("~/trang-chu");
            }
        }
    }
}